<template>
    <view class="bg-content">

        <scroll-view scroll-x="true">
            <div class="table table-bordered" style="text-align: center; background: white; width: 500px;">
                <div class="tr">
                    <div class="td text-center bold" style="width: 150px;">抽奖时间</div>
                    <div class="td text-center bold" style="width: 150px;">活动奖品</div>
                    <div class="td text-center bold" style="width: 200px;">中奖奖品</div>
                </div>
                <div class="tr" v-for="(item, index)  in tbCommunityLotteryList" :key="item.id">
                    <div class="td text-center" style="width: 150px;">{{item.lotteryDate}}</div>
                    <div class="td text-center" style="width: 150px;">{{'item.tbCommunityLotteryUser.lotteryIntegralText' | toValue(item)}}</div>
                    <div class="td text-center" style="width: 200px;">
                        <myImg :obj="item.tbCommunityLotteryUser"
                               :sysFile="{fkId: item.tbCommunityLotteryUser.goodsId, typeMark: 'thumbnail'}"
                               :customStyle="'pointer-events: none; height: 100px;  width:100px; background-size: cover; background-repeat: no-repeat; background-position: center;'"
                               :defaultUrl="'/pages/sub/sub3-community-platform/static/default-image/goods.jpg'"
                               :imageView="'imageView2/1/w/300/h/300'"
                        ></myImg>
                        <div>
                            <div style="font-size: 16px;">{{tbCommunityLottery.tbCommunityLotteryUser.goodsTitle}}
                            </div>
                            <div style="font-size: 16px;margin-top: 6px">
                                <span class="bold skin-font"
                                      style="font-size: 16px">￥{{tbCommunityLottery.tbCommunityLotteryUser.goodsPrice | toFixed2}}</span>
                            </div>
                            <div style="text-align: right; margin-top: 10px;">奖品已寄出：{{tbCommunityLottery.tbCommunityLotteryUser.goodsIsDelivered ? '是' : '否'}}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </scroll-view>

        <div style="padding-top: 10px; padding-bottom: 10px;">
            <u-loadmore :status="pagination.status" bg-color="#eeeeee"/>
        </div>
    </view>
</template>

<script>

    import {TbCommunityLotteryService} from "@/dev/services/tb-community-lottery.service";
    import myImg from '@/components/my-img'

    export default {
        data() {
            return {
                tbCommunityLotteryList: [],
            }
        },
        components: {
            myImg
        },
        onShow() {
            const _self = this;
            _self.doRefresh(this.tbCommunityLotteryList);
        },
        // 上拉加载
        onReachBottom: function () {
            if (this.pagination.hasNextPage) {
                this.doInfinite()
            }
        },
        methods: {
            /**
             * 加载更多数据中
             * @param infiniteScroll
             */
            doInfinite(infiniteScroll) {
                const _self = this;
                new TbCommunityLotteryService().findTableTbCommunityLotteryListByMyWinning({
                    pagination: _self.pagination,
                    data: {
                        communityId: _self.globalVariable.userInfo.tbCommunity.id,
                        userId: _self.globalVariable.userInfo.id
                    }
                }).then(result => {
                    _self.pagination.refreshPage(result);
                    _self.tbCommunityLotteryList = [..._self.tbCommunityLotteryList, ...result.list];
                });
            },
        }
    }
</script>

<style lang="scss" scoped>
</style>
